
import { FileServerProxy } from './api'
export const GJDBFunction = async (procName, type,cityCode) => {
  let paer1 = {
    procName: procName,
    dtParams: JSON.stringify([
      { I_USERID: "'" + window.localStorage.getItem('DanDianid') + "'", I_TYPE: type },
    ]),
    token: window.localStorage.getItem("token"),
  };
  let procNamesk1 = {
    accessCode: "69db6bece3a7480592e2ec753d1e335e",
    cityCode: cityCode?cityCode:window.localStorage.getItem("citycode")
      ? window.localStorage.getItem("citycode")
      : "441300000000",
    params: paer1,
  };
  const reskh1 = await FileServerProxy(procNamesk1);
  try {
    let data1 = eval('(' + reskh1.data.data + ')').Data
    return data1
  } catch (err) {
    console.log(err)
  }
}

export const GJDBFunction1 = async (procName, data, type) => {
  let paer1 = {
    procName: procName,
    dtParams: JSON.stringify([
      { I_USERID: "'" + data + "'", I_TYPE: type },
    ]),
    token: window.localStorage.getItem("token"),
  };
  let procNamesk1 = {
    accessCode: "69db6bece3a7480592e2ec753d1e335e",
    cityCode: window.localStorage.getItem("citycode")
      ? window.localStorage.getItem("citycode")
      : "441300000000",
    params: paer1,
  };
  const reskh1 = await FileServerProxy(procNamesk1);
  try {
    let data1 = eval('(' + reskh1.data.data + ')').Data
    return data1
  } catch (err) {
    console.log(err)
  }
}
export const GJDBFunction3 = async (procName, data, type) => {
    let paer1 = {
      procName: procName,
      dtParams: JSON.stringify([
        { I_USERID: "'" + data + "'", I_TYPE: type },
      ]),
      token: window.localStorage.getItem("token"),
    };
    let procNamesk1 = {
      accessCode: "69db6bece3a7480592e2ec753d1e335e",
      cityCode: window.localStorage.getItem("citycodeChange")
        ? window.localStorage.getItem("citycodeChange")
        : "441300000000",
      params: paer1,
    };
    const reskh1 = await FileServerProxy(procNamesk1);
    try {
      let data1 = eval('(' + reskh1.data.data + ')').Data
      return data1
    } catch (err) {
      console.log(err)
    }
  }

export const GJDBFunction2 = async (procName, data) => {
  let paer1 = {
    procName: procName,
    dtParams: JSON.stringify(data),
    token: window.localStorage.getItem("token"),
  };
  let procNamesk1 = {
    accessCode: "69db6bece3a7480592e2ec753d1e335e",
    cityCode: window.localStorage.getItem('isGJM') == 'true'?window.localStorage.getItem("citycode"):window.localStorage.getItem("citycodeChange"),
    params: paer1,
  };
  const reskh1 = await FileServerProxy(procNamesk1);
  try {
    let data1 = eval('(' + reskh1.data.data + ')').Data
    return data1
  } catch (err) {
    console.log(err)
  }
}
